Interrupt 21h Function 7143h 

Retrieves or sets the file attributes, gets the compressed file size, or retrieves or sets the date and time for the given file.

mov ax, 7143h         ; Get or Set File Attributes
mov bl, Action        ; see below
mov cx, Attributes    ; see below
mov di, Date          ; see below
mov cx, Time          ; see below
mov si, MilliSeconds  ; see below
mov dx, seg Filename  ; see below
mov ds, dx
mov dx, offset Filename
int 21h

jc  error
; see below for return values

 

Parameters

Action

Action to take. This parameter can be one of the following values:

0

Retrieve attributes.

1

Set specified attributes.

2

Get physical size of a compressed file.

3

Set last write date/time.

4

Get last write date/time.

5

Set last access date.

6

Get last access date.

7

Set creation date/time.

8

Get creation date/time.

 

Attributes

File attributes to set, which are used only if Action is 1. This parameter can be a combination of these values:

 

_A_NORMAL (0000h)

 

 

The file can be read from or written to. This value is valid only if used alone.

 

_A_RDONLY (0001h)

 

 

The file can be read from, but not written to.

 

_A_HIDDEN (0002h)

 

 

The file is hidden and does not appear in an ordinary directory listing.

 

_A_SYSTEM (0004h)

 

 

The file is part of the operating system or is used exclusively by it.

 

_A_ARCH (0020h)

 

 

The file is an archive file. Applications use this value to mark files for backup or removal.

 

 

Time

New time to set, which is used only if Action is 3 (set last write date/time) or 7 (set creation date/time) The time is a packed 16-bit value with the following form:

 

Bits

Contents

0-4

Second divided by 2

5-10

Minute (0-59)

11-15

Hour (0-23 on a 24-hour clock)

 

Date

New date to set, which is used only if Action is 3 (set last write date/time), 5 (set last access date), or 7 (set creation date/time). The date is a packed 16-bit value with the following form:

 

Bits

Contents

0-4

Day of the month (1-31)

5-8

Month (1 = January, 2 = February, and so on)

9-15

Year offset from 1980 (that is, add 1980 to get the actual year)

 

MilliSeconds

Number of 10 millisecond intervals in 2 seconds to add to the MS-DOS time. The number can be a value in the range 0 to 199. This value is only used if Action is 7 (set creation date/time).

Filename

Address of a null-terminated string specifying the name of the file to retrieve or set attributes for. Long filenames are allowed.

 

Return Value

Clears the carry flag if successful.

If Action is zero (retrieve attributes), the file attributes returned in the CX register may be a combination of the following values :

_A_NORMAL (0000h)

_A_RDONLY (0001h)

_A_HIDDEN (0002h)

_A_SYSTEM (0004h)

_A_VOLID (0008h)

_A_SUBDIR (0010h)

_A_ARCH (0020h)

 

If Action is 2 (get physical size of a compressed file), the size, in bytes, of the compressed file is returned in DX:AX. This value is the physical size of the compressed file   that is, the actual number of bytes that the compressed file occupies on disk.

If Action is 4 (get last write date/time) or 8 (get creation date/time), the CX register contains the time as a packed 16-bit value with the following form:

Bits

Contents

0-4

Second divided by 2

5-10

Minute (0-59)

11-15

Hour (0-23 on a 24-hour clock)

 

If Action is 4 (get last write date/time), 6 (get last access date), or 8 (get creation date/time), the DI register contains the date as a packed 16-bit value with the following form:

Bits

Contents

0-4

Day of the month (1-31)

5-8

Month (1 = January, 2 = February, and so on)

9-15

Year offset from 1980 (that is, add 1980 to get the actual year)

 

If Action is 8 (get creation date/time), the SI register contains the number of 10 millisecond intervals in 2 seconds to add to the MS-DOS time. The number can be a value in the range of 0 to 199.

If the function is not successful, it sets the carry flag and sets the AX register to an error value.